package com.glory.gloryquickui.widget.dialog;//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//


import android.app.Dialog;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatDialogFragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;

import com.glory.gloryquickui.R;
import com.glory.gloryquickui.utils.InitUtils;
import com.glory.gloryquickui.widget.dialog.callback.FreeUI_CommonCallback;

public class FreeUI_GeneralFragmentDialog extends AppCompatDialogFragment {
    private View view;
    private FreeUI_CommonCallback callBack;

    public FreeUI_GeneralFragmentDialog() {
    }

    public void show(FragmentManager manager, String tag) {
        if (!this.isAdded()) {
            FragmentTransaction ft = manager.beginTransaction();
            ft.add(this, tag);
            ft.commitAllowingStateLoss();
        }

    }

    public void onStart() {
        super.onStart();
        Dialog dialog = this.getDialog();
        if (dialog != null) {
            dialog.getWindow().setLayout((int)((double) InitUtils.Companion.getSCREEN_WIDTH() * 0.8D), -2);
        }

    }

    public void setLayout(View view) {
        this.view = view;
    }

    public void setCallBack(FreeUI_CommonCallback callBack) {
        this.callBack = callBack;
    }

    @Nullable
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        this.getDialog().getWindow().setGravity(17);
        this.getDialog().getWindow().setBackgroundDrawable(new ColorDrawable(0));
        this.getDialog().getWindow().setWindowAnimations(R.style.BottomDialog);
        this.getDialog().setCancelable(false);
        return this.view;
    }

    public void onDestroy() {
        super.onDestroy();
        if (this.callBack != null) {
            this.callBack.onSuccess();
        }

    }
}
